/* 
 * File:   TestBodyFactoryDynamic.cpp
 * Author: mauro
 *
 * Created on 06/09/2014, 21:43:25
 */

#include <stdlib.h>
#include <iostream>
#include <Box2D/Box2D.h>
#include "Model/BodyFactoryDynamic.h"

/*
 * Simple C++ Test Suite
 */

void testBodyFactoryDynamic() {
    BodyFactoryDynamic bodyFactoryDynamic();
    if (false /*check result*/) {
        std::cout << "%TEST_FAILED% time=0 testname=testBodyFactoryDynamic (TestBodyFactoryDynamic) message=error message sample" << std::endl;
    }
}

void testBodyFactoryDynamicConstructorConParametro() {
    b2Vec2 gravity(0.0f, 9.8f);
    b2World world(gravity);
    BodyFactoryDynamic factory(world);

}

void testGetBodyCircle() {
    int sides = 0;
    b2Vec2 pos(1.0f, 1.0f);
    b2Vec2 size(2.0f, 3.0f);
    int scale = 2;
    //factory
    b2Vec2 gravity(0.0f, 9.8f);
    b2World world(gravity);
    BodyFactoryDynamic factory(world);
    b2Body* body = factory.getBody(sides, pos, size, scale);
    if (body == NULL) {
        std::cout << "%TEST_FAILED% time=0 testname=testGetBodyCircle (TestBodyFactoryDynamic) message= error" << std::endl;
        return;
    }

    b2Vec2 poss = body->GetPosition();
    if (poss.x != 1.0f && poss.y != 1.0f) {
        std::cout << "%TEST_FAILED% time=0 testname=testGetBodyCircle (TestBodyFactoryDynamic) message=error posicion incorrecta" << std::endl;
        return;
    }
}

void testGetBodyTriangulo() {
    int sides = 3;
    b2Vec2 pos(1.0f, 1.0f);
    b2Vec2 size(2.0f, 3.0f);
    int scale = 2;
    //factory
    b2Vec2 gravity(0.0f, 9.8f);
    b2World world(gravity);
    BodyFactoryDynamic factory(world);
    b2Body* body = factory.getBody(sides, pos, size, scale);
    if (body == NULL) {
        std::cout << "%TEST_FAILED% time=0 testname=testGetBodyTriangulo (TestBodyFactoryDynamic) message= error" << std::endl;
        return;
    }

    b2Vec2 poss = body->GetPosition();
    if (poss.x != 1.0f && poss.y != 1.0f) {
        std::cout << "%TEST_FAILED% time=0 testname=testGetBodyTriangulo (TestBodyFactoryDynamic) message=error posicion incorrecta" << std::endl;
        return;
    }

}

void testGetBodyCuadrado() {
    int sides = 0;
    b2Vec2 pos(1.0f, 1.0f);
    b2Vec2 size(2.0f, 3.0f);
    int scale = 2;
    //factory
    b2Vec2 gravity(0.0f, 9.8f);
    b2World world(gravity);
    BodyFactoryDynamic factory(world);
    b2Body* body = factory.getBody(sides, pos, size, scale);
    if (body == NULL) {
        std::cout << "%TEST_FAILED% time=0 testname=testGetBodyCuadrado (TestBodyFactoryDynamic) message= error" << std::endl;
        return;
    }

    b2Vec2 poss = body->GetPosition();
    if (poss.x != 1.0f && poss.y != 1.0f) {
        std::cout << "%TEST_FAILED% time=0 testname=testGetBodyCuadrado (TestBodyFactoryDynamic) message=error posicion incorrecta" << std::endl;
        return;
    }
}

void testGetBodyRectangulo() {
    int sides = 0;
    b2Vec2 pos(1.0f, 1.0f);
    b2Vec2 size(2.0f, 3.0f);
    int scale = 2;
    //factory
    b2Vec2 gravity(0.0f, 9.8f);
    b2World world(gravity);
    BodyFactoryDynamic factory(world);
    b2Body* body = factory.getBody(sides, pos, size, scale);
    if (body == NULL) {
        std::cout << "%TEST_FAILED% time=0 testname=testGetBodyRectangulo (TestBodyFactoryDynamic) message= error" << std::endl;
        return;
    }

    b2Vec2 poss = body->GetPosition();
    if (poss.x != 1.0f && poss.y != 1.0f) {
        std::cout << "%TEST_FAILED% time=0 testname=testGetBodyRectangulo (TestBodyFactoryDynamic) message=error posicion incorrecta" << std::endl;
        return;
    }
}

void testGetBodyPoligono5() {
    int sides = 0;
    b2Vec2 pos(1.0f, 1.0f);
    b2Vec2 size(2.0f, 3.0f);
    int scale = 2;
    //factory
    b2Vec2 gravity(0.0f, 9.8f);
    b2World world(gravity);
    BodyFactoryDynamic factory(world);
    b2Body* body = factory.getBody(sides, pos, size, scale);
    if (body == NULL) {
        std::cout << "%TEST_FAILED% time=0 testname=testGetBodyPoligono5 (TestBodyFactoryDynamic) message= error" << std::endl;
        return;
    }

    b2Vec2 poss = body->GetPosition();
    if (poss.x != 1.0f && poss.y != 1.0f) {
        std::cout << "%TEST_FAILED% time=0 testname=testGetBodyPoligono5 (TestBodyFactoryDynamic) message=error posicion incorrecta" << std::endl;
        return;
    }
}

void testGetBodyPoligono6() {
    int sides = 0;
    b2Vec2 pos(1.0f, 1.0f);
    b2Vec2 size(2.0f, 3.0f);
    int scale = 2;
    //factory
    b2Vec2 gravity(0.0f, 9.8f);
    b2World world(gravity);
    BodyFactoryDynamic factory(world);
    b2Body* body = factory.getBody(sides, pos, size, scale);
    if (body == NULL) {
        std::cout << "%TEST_FAILED% time=0 testname=testGetBodyPoligono6 (TestBodyFactoryDynamic) message= error" << std::endl;
        return;
    }

    b2Vec2 poss = body->GetPosition();
    if (poss.x != 1.0f && poss.y != 1.0f) {
        std::cout << "%TEST_FAILED% time=0 testname=testGetBodyPoligono6 (TestBodyFactoryDynamic) message=error posicion incorrecta" << std::endl;
        return;
    }
}

int main(int argc, char** argv) {
    std::cout << "%SUITE_STARTING% TestBodyFactoryDynamic" << std::endl;
    std::cout << "%SUITE_STARTED%" << std::endl;

    std::cout << "%TEST_STARTED% testBodyFactoryDynamic (TestBodyFactoryDynamic)" << std::endl;
    testBodyFactoryDynamic();
    std::cout << "%TEST_FINISHED% time=0 testBodyFactoryDynamic (TestBodyFactoryDynamic)" << std::endl;

    std::cout << "%TEST_STARTED% testBodyFactoryDynamic2 (TestBodyFactoryDynamic)" << std::endl;
    testBodyFactoryDynamicConstructorConParametro();
    std::cout << "%TEST_FINISHED% time=0 testBodyFactoryDynamicConstructorConParametro (TestBodyFactoryDynamic)" << std::endl;

    std::cout << "%TEST_STARTED% testGetBodyCircle (TestBodyFactoryDynamic)" << std::endl;
    testGetBodyCircle();
    std::cout << "%TEST_FINISHED% time=0 testGetBodyCircle (TestBodyFactoryDynamic)" << std::endl;

    std::cout << "%TEST_STARTED% testGetBodyTriangulo (TestBodyFactoryDynamic)" << std::endl;
    testGetBodyTriangulo();
    std::cout << "%TEST_FINISHED% time=0 testGetBodyTriangulo (TestBodyFactoryDynamic)" << std::endl;

    std::cout << "%TEST_STARTED% testGetBodyCuadrado (TestBodyFactoryDynamic)" << std::endl;
    testGetBodyCuadrado();
    std::cout << "%TEST_FINISHED% time=0 testGetBodyCuadrado (TestBodyFactoryDynamic)" << std::endl;

    std::cout << "%TEST_STARTED% testGetBodyRectangulo (TestBodyFactoryDynamic)" << std::endl;
    testGetBodyRectangulo();
    std::cout << "%TEST_FINISHED% time=0 testGetBodyRectangulo (TestBodyFactoryDynamic)" << std::endl;

    std::cout << "%TEST_STARTED% testGetBodyPoligono5 (TestBodyFactoryDynamic)" << std::endl;
    testGetBodyPoligono5();
    std::cout << "%TEST_FINISHED% time=0 testGetBodyPoligono5 (TestBodyFactoryDynamic)" << std::endl;

    std::cout << "%TEST_STARTED% testGetBodyPoligono6 (TestBodyFactoryDynamic)" << std::endl;
    testGetBodyPoligono6();
    std::cout << "%TEST_FINISHED% time=0 testGetBodyPoligono6 (TestBodyFactoryDynamic)" << std::endl;

    std::cout << "%SUITE_FINISHED% time=0" << std::endl;

    return (EXIT_SUCCESS);
}

